<!DOCTYPE html>
<html lang="en">
<head>
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="yes" name="apple-touch-fullscreen">
    <meta content="telephone=no,email=no" name="format-detection">
    <meta name="wap-font-scale" content="no">
    <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title><?=$title?></title>
    <link rel="stylesheet" href="/mobile/css/reset.css">
    <link rel="stylesheet" href="/mobile/css/mui.min.css">
    <link rel="stylesheet" href="/mobile/css/dropload.css">
    <script src="/mobile/js/flexible_css.debug.js"></script>
    <script src="/mobile/js/flexible.debug.js"></script>
    <link rel="stylesheet" href="/mobile/css/main_train.css">

</head>
<body style="height: auto;">
<div id="back-btn-wrap">
    <a class="back-btn" href="javascript:history.go(-1)"></a><i id="nav-title">成绩排名</i>
</div>
<div class="content-main">
    <h2 id="gs-title">2017年度&nbsp;共: <i id="total-num"></i>题</h2>
    <ul id="good-list-wrap">
        <li class="parent-list">
            <ul class="child-list-wrap" style="">
            </ul>
        </li>
    </ul>
</div>

<script src="/mobile/js/jquery.min.js"></script>
<script src="/mobile/js/dropload.js"></script>
<script src="/mobile/js/common.js"></script>
<script src="/mobile/js/mui.min.js"></script>
<script src="/mobile/js/jrrpc.js"></script>

<script>
    $(function(){
        mui.init();
        function exitEdit(e){
            e.preventDefault();
//          回到app
            if(iService.getUserAgent().isiOS){
                ScoreList();
            }else {
                h5button.ScoreList();
            }
        }
        $(".back-btn").on('click',exitEdit);

        var appParam = iService.getAppParam();
        var page = 1;
        var rankListWrap = $('.child-list-wrap');
        function getData(page,me){
            var param = {
                postData:'Question/ranking',
                data: {
                    page:page
                }
            };
            $.extend(param.data,appParam);
            $.JsonRpc(param,function(result){
                var data = result.data;
                if(!rankListWrap.attr('data-page')){
                    rankListWrap.attr('data-page',result.data.count);
                }
                if(me){
                    me.resetload();
                }
                if(!result.data.count){
                    $('.dropload-noData').html('暂无数据');
                    return false;
                }
                $("#total-num").html(data.lists[0].total);
                $.each(data.lists,function(i){
                    $(
                            '<li class="child-list">'+
                            '<span class="avatar-member" style="background: url('+data.lists[i].avatar+') center center no-repeat; background-size: cover;"></span>'+
                            '<span>'+data.lists[i].nickname+' </span>'+
                            '<span>'+data.lists[i].section+' </span>'+
                            '<span>答对'+data.lists[i].correct+'题目</span>'+
                            '<i class="fr rank">'+(parseInt(i)+1)+'</i>'+
                            '</li>'
                    ).appendTo('.child-list-wrap');

                });

            },me);
        }

//      下拉加载
        $('.content-main').dropload({
//                滑动区域
            scrollArea: window,
//                autoLoad:false,
            distance: 50,
            threshold: "",
            domDown: {
                domClass: "dropload-down",
                domRefresh: '<div class="dropload-refresh">↑上拉加载更多</div>',
                domLoad: '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
                domNoData: '<div class="dropload-noData">已加载全部</div>'
            },
            loadDownFn: function(me){
                if(page==1){
                    getData(page,me);
                    page +=1;
                }else if(page<=Math.ceil(rankListWrap.attr('data-page')/3)
                ){
                    getData(page,me);
                    page +=1;
                }else {
                    me.lock();//没有更多数据
                    me.noData();//没有更多数据
                    me.resetload();
                }
            }
        });
        $.get('https://www.wzxaini9.cn/api/flow/index/id/11', function (data) {
            console.log($.parseJSON(data));
        })
    });
</script>
</body>
</html>












